@extends('admin.layouts.master')
@section('content')
    <link rel="stylesheet" href="{{url('/css/app.css')}}">
    <div class="col-md-12">
        <!-- 自定义内容区域 -->
        <div class="panel panel-default">
            <div class="panel-heading">修改管理员用户</div>
            <div class="panel-body">
                <form class="form-horizontal"
                      action="{{url('admin/admin_user/update',['id'=>$user->id])}}"  method="post" >
                    {{csrf_field()}}
                 {{--{{dd($user)}}--}}
                    <div class="form-group">
                        <label for="name" class="col-sm-2 control-label">管理员名：</label>

                        <div class="col-sm-5">
                            <input type="text" name="name" value="{{$user->name}}">
                        </div>

                    </div>
                    {{--<div class="form-group">--}}
                        {{--<label for="password" class="col-sm-2 control-label">管理员密码：</label>--}}

                        {{--<div class="col-sm-5">--}}
                            {{--<input type="text" name="password" value="{{$user->password}}">--}}
                        {{--</div>--}}
                    {{--</div>--}}
                    <div class="form-group">
                        <label class="col-sm-2 control-label">角色名称：</label>

                        <div class="col-sm-5">

                            @foreach($roles as $role)
                                {{--in_array() 函数搜索数组中是否存在指定的值--}}
                                @if(in_array($role->id, $role_ids))
                                    <label>
                                        <input type="checkbox" name="role_id[]"
                                               value="{{$role->id}}" checked>{{$role->display_name}}
                                    </label>
                                @else
                                    <label>
                                        <input type="checkbox" name="role_id[]"
                                               value="{{$role->id}}">{{$role->display_name}}
                                    </label>
                                @endif
                            @endforeach

                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-offset-2 col-sm-10">
                            <button type="submit" id="addpermission" class="btn btn-primary">提交</button>
                            <button type="submit" onclick="history.go(-1)" class="back btn btn-primary">返回</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>

@endsection

